﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Game
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SHDocVw.ShellWindows sws = new SHDocVw.ShellWindows();
            StringBuilder sb = new StringBuilder();
            //sws为当前打开的所有IE窗口
            //foreach (SHDocVw.InternetExplorer iw in sws)
            //{
            //    //获取窗口的URL
            //    sb.AppendLine(iw.LocationURL);
            //    object a = iw.Document;
            //    Type type = a.GetType();
            //    mshtml.HTMLDocumentClass aa = a as mshtml.HTMLDocumentClass;
            //    if (aa != null)
            //    {
            //        string stringvalue = aa.all.length.ToString();
            //    }
            //}
            MessageBox.Show((sws.Item(sws.Count - 1) as SHDocVw.InternetExplorer).LocationURL);

        }
    }
}
